]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensions-app: Reset switch handle when it becomes insensitive
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 18 May 2020 12:24:16 +0000 (14:24 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 21 May 2020 21:29:31 +0000 (21:29 +0000)
Currently the switches handle position reflects the requested
extension state (as in: the user (de)activated the switch),
while the actual extension state is reflected by the underlying
state.

That doesn't work well when the switch is insensitive though (for
example on error), because the desaturation neuters the color
that reflects the state.

Address this by resetting the switch handle to the state when
making it insensitive.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1263

subprojects/extensions-app/data/ui/extension-row.ui
subprojects/extensions-app/js/main.js

index f54ab3c760e1819da5133263fc172a1c9ea10c25..4753cbc23933ec97b15ca517a677c61c319c2ae1 100644 (file)
@@ -54,7 +54,7 @@
           </object>
         </child>
         <child>
-          <object class="GtkSwitch">
+          <object class="GtkSwitch" id="switch">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="valign">center</property>
index 005d1ddc65c083474b22cdade041d6f2f84ce505..264e684e8f6f8acf7a6676a040c264538ebf4195 100644 (file)
@@ -332,6 +332,7 @@ var ExtensionRow = GObject.registerClass({
         'versionLabel',
         'authorLabel',
         'updatesIcon',
+        'switch',
         'revealButton',
         'revealer',
     ],
@@ -451,6 +452,9 @@ var ExtensionRow = GObject.registerClass({
         action.set_state(new GLib.Variant('b', state));
         action.enabled = this._canToggle();
 
+        if (!action.enabled)
+            this._switch.active = state;
+
         this._updatesIcon.visible = this.hasUpdate;
 
         this._versionLabel.label = this.version.toString();